package nettysocket;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerAdapter;
import io.netty.channel.ChannelHandlerContext;

/**
 * Created by Bruce.
 * Time: 2019/4/5 19:47
 */
public class BusinessHandler extends ChannelHandlerAdapter {

  @Override
  public void channelRead(ChannelHandlerContext ctx, Object msg)
          throws Exception {
    ByteBuf buf = (ByteBuf) msg;
    System.out.println(buf.readableBytes());
    System.out.println(buf.readInt());
    byte[] req = new byte[buf.readableBytes()];
    buf.readBytes(req);
    System.out.println();
  }
}
